package kr.or.javacafe.game;

public class Card {
	public static final String[] deck={"H","D","C","S"};
	public static final String[] stic={"A","2","3","4","5","6","7","8","9","T","J","Q","K"};
	private String card;
	
	public Card(){
		init();
	}
	
	public void init(){
		int a = (int)(Math.random() * deck.length);
		int b = (int)(Math.random() * stic.length);
		card = deck[a]+stic[b]; // H8
	}
	
	public String getCard(){
		return card;
	}
	
	@Override
	public String toString() {
		return "["+card+"]";
	}
	
	@Override
	public boolean equals(Object obj) {
		boolean isS = false;
		Card cd = (Card)obj;
		if(card.equals(cd.getCard())){
			isS = true;
		}
		return isS;
	}
	
	@Override
	public int hashCode() {
		return card.hashCode()+137;
	}
}








